package com.youku.expression.ast;

import com.youku.expression.environment.Environment;

public class BaseAst extends Ast {

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		for (Ast ast : children()) {
			builder.append('\n').append(ast);
		}

		return builder.append('\n').toString();
	}

	@Override
	public Object eval(Environment environment) {
		Object result = null;
		for (Ast child : children()) {
			result = child.eval(environment);
		}

		return result;
	}

}
